home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
PROGRAMMING
/
DESKLIBC
/
SOURCES.ZIP
/
DeskLib
/
!DLSources
/
Libraries
/
Str
/
c
/
strcmpcr
< prev
next >
Wrap
Text File
|
1995-07-08
|
2KB
|
48 lines
/*
#### # # # #
# # # # # The FreeWare C library for
# # ## ### # # # # ### RISC OS machines
# # # # # # # # # # # ___________________________________
# # #### ### ## # # # #
# # # # # # # # # # Please refer to the accompanying
#### ### #### # # ##### # ### documentation for conditions of use
________________________________________________________________________
File: Template.strcmpcr.c
Author: Copyright © 1993 Jason Williams
Version: 1.00 (16 May 1993)
Purpose: Compare two CR-terminated strings to see if they match
*/
#include "DeskLib:Str.h"
/*
* compares the string pointed to by s1 to the string pointed to by s2.
* Returns: an integer greater than, equal to, or less than zero, according
* as the string pointed to by s1 is greater than, equal to, or
* less than the string pointed to by s2.
*/
extern int strcmpcr(char *s1, char *s2)
{
register int index = 0;
while (s1[index] > 31 && s2[index] > 31)
{
if (s1[index] > s2[index])
return(1);
else
if (s1[index] < s2[index])
return(-1);
index++;
}
if (s1[index] > 31) /* s1 is longer than s2, so is greater than */
return(1);
if (s2[index] > 31) /* s2 is longer than s1, so result is less than */
return(-1);
return(0); /* Strings exactly match */
}